﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Slf;

namespace Project.Under.Test
{
  public class CommunicationLogic
  {
    /// <summary>
    /// The <see cref="ILogger"/> used to log messages
    /// </summary>
    private static ILogger logger = LoggerService.GetLogger(typeof(CommunicationLogic).FullName);

    /// <summary>
    /// A service used by this class
    /// </summary>
    private IRemoteService remoteService;

    public CommunicationLogic(IRemoteService remoteService)
    {
      this.remoteService = remoteService;
    }

    public void SendMessage(string message)
    {
      try
      {
        remoteService.SendMessage(message);
      }
      catch (Exception e)
      {
        logger.Warn(e, "Failed to send the given message [{0}]",
          message);        
      }
    }
  }
}
